package com.hzy.seatastorage.storage.controller;

import com.hzy.common.entities.CommonResult;
import com.hzy.seatastorage.storage.service.StorageService;
import com.hzy.storage.entities.Storage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 这里填写描述
 * 填写修改说明
 *
 * @author hzy
 * @version Revision:v1.0
 * @since Date:2022-03-15 17:04
 */
@Slf4j
@RestController
public class StorageController {

    @Autowired
    private StorageService storageService;

    @PostMapping("/storage/decrease")
    public CommonResult<Storage> decrease(@RequestParam("productId") String productId, @RequestParam("count") Integer count){
        Storage storage = storageService.decrease(productId, count);
        return new CommonResult<>(200, "扣减库存成功!", storage);
    }
}
